@include('admin.layout.bone_header')

<div class="layui-form layui-form-pane search">

    <div class="layui-form-item">


        <label class="layui-form-label">会员ID</label>
        <div class="layui-input-inline">
            <input type="text" id="user_id" autocomplete="off" placeholder="请输入会员ID" class="layui-input">
        </div>
        <button class="layui-btn" data-type="reload">搜索</button>
    </div>
</div>


<table class="layui-hide" id="think-table" lay-filter="think-table"></table>

<script type="text/html" id="barDemo">


{{--    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="recharge">充值</a>--}}


</script>

<script>

    layui.use('table', function () {
        let table = layui.table;
        UI.getPageTable(table, "{{route('admin.bills.bills')}}", [
            {field: 'bills_id', title: 'ID', width: 80, sort: true, fixed: 'left'}
            , {field: 'user_id', title: ' 用户ID'}
            , {field: 'nums', title: ' 数量'}
            , {field: 'title', title: ' 类型'}
            , {field: 'balance', title: ' 余额'}
            , {field: 'time', title: ' 时间',templet:function (d){
                    return Utils.paraseTime(d['created_at']);
            }}
        ]);

        table.on('tool(think-table)', function (obj) {
            let data = obj.data;

        });
        let $ = layui.$, active = {
            reload:function (){
                let user_id = $('#user_id');
                //执行重载
                table.reload('think-table', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                        'user_id':user_id.val()
                    }
                });
            }
        };
        $('.layui-btn-container .layui-btn').on('click', function () {
            let type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        $('.search .layui-btn').on('click', function () {
            let type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

    })


</script>


@include('admin.layout.bone_footer')
